$(function () {
    let loginName = sessionStorage.getItem("loginName");
    if (loginName == null) {
        window.open("/login.html", "_parent");
        // window.location.href = "";
    }
});

function myAjax(url, data, type) {
    //只要是需要变动的应该以参数进行传递
    let result;
    $.ajax({
        url: url,
        data: data,
        type: type,
        async: false,
        dataType: 'json',
        success: function (data) {
            console.log(data, 'myajax');
            if (data.result == "noLogin") {
                window.open("/login.html", "_parent");
                // window.location.href = "";
            }
            result = data;
        }
    });
    return result;
}

function judge(data) {
    if (data.result == "noLogin") {
        window.open("/login.html", "_parent");
        // window.location.href = "";
    }
}